package cn.com.ddapp.ddm.util;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;


public class SPUtils {

	public static String ISLOGIN = "islogin";//是否登录
	public static String EMAIL = "userName";
	public static String USERID = "userId";//会员Id
	public static String ISSAVEWH="issavewh";
	public static String USERSEX = "usersex";//会员性别
	public static String USERPATH= "headImg";//会员头像地址
	public static String BIRTHDAY= "birthDay";//会员生日
    public static String ISGOODS="isgoods";
    public static String ISText="istext";
	public static String USERNAME= "nickname";//会员昵称
	public static String LID= "lid";//会员昵称
	public static String AREANAME= "丰城市";//地区
	public static String REFID= "5";//计算加急邮费id
	public static String ISFIRST= "true";
    public static String ATMCODE="atmcode"; //atm编码

	public SPUtils() {
		/* cannot be instantiated */
		throw new UnsupportedOperationException("cannot be instantiated");
	}

	/**
	 * 保存在手机里面的文件名
	 */
	public static final String FILE_NAME = "sp_data";

	public static void setStringData(Context mContext, String key, String value) {
		SharedPreferences preferences = mContext.getSharedPreferences(
				FILE_NAME, Activity.MODE_PRIVATE);
		SharedPreferences.Editor editor = preferences.edit();
		editor.putString(key, value);
		editor.commit();
	}

	public static String getStringData(Context mContext, String key) {
		SharedPreferences sharedPreferences = mContext.getSharedPreferences(
				FILE_NAME, Activity.MODE_PRIVATE);
		String string = sharedPreferences.getString(key, "");
		return string;
	}

	public static void setBooleanData(Context mContext, String key,
									  boolean value) {
		SharedPreferences preferences = mContext.getSharedPreferences(
				FILE_NAME, Activity.MODE_PRIVATE);
		SharedPreferences.Editor editor = preferences.edit();
		editor.putBoolean(key, value);
		editor.commit();
	}

	public static boolean getBooleanData(Context mContext, String key) {
		SharedPreferences sharedPreferences = mContext.getSharedPreferences(
				FILE_NAME, Activity.MODE_PRIVATE);
		boolean b = sharedPreferences.getBoolean(key, false);
		return b;
	}

	public static void setIntData(Context mContext, String key,
								  int value) {
		SharedPreferences preferences = mContext.getSharedPreferences(
				FILE_NAME, Activity.MODE_PRIVATE);
		SharedPreferences.Editor editor = preferences.edit();
		editor.putInt(key, value);
		editor.commit();
	}

	public static int getInteanData(Context mContext, String key, int value) {
		SharedPreferences sharedPreferences = mContext.getSharedPreferences(
				FILE_NAME, Activity.MODE_PRIVATE);
		int b = sharedPreferences.getInt(key, value);
		return b;
	}

}